package com.xbongbong.admin.model.impl;

import com.xbongbong.admin.domain.dao.MirrorPrintTemplateDao;
import com.xbongbong.admin.domain.entity.MirrorPrintTemplateEntity;
import com.xbongbong.admin.model.MirrorPrintTemplateModel;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.DateUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 镜像打印模板配置
 * @author xingxing.xiao
 * @date 2020/01/09 16:42
 */
@Service("mirrorPrintTemplateModel")
public class MirrorPrintTemplateModelImpl implements MirrorPrintTemplateModel {

    @Resource
    private MirrorPrintTemplateDao mirrorPrintTemplateDao;

    @Override
    public Integer insert(MirrorPrintTemplateEntity entity) throws XbbException {
        long now = DateUtil.getInt();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        return mirrorPrintTemplateDao.insert(entity);
    }

    @Override
    public Integer update(MirrorPrintTemplateEntity entity) throws XbbException {
        long now = DateUtil.getInt();
        entity.setUpdateTime(now);
        return mirrorPrintTemplateDao.update(entity);
    }

    @Override
    public List<MirrorPrintTemplateEntity> findEntitys(Map<String, Object> param) {
        return mirrorPrintTemplateDao.findEntitys(param);
    }

    /**
     * 批量插入
     * @param list
     * @return
     */
    @Override
    public List<MirrorPrintTemplateEntity> insertBatch(List<MirrorPrintTemplateEntity> list) {
        mirrorPrintTemplateDao.insertBatch(list);
        return list;
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return mirrorPrintTemplateDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }
}
